home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / util / cli / showicon.lha / ShowIcon.c < prev    next >
C/C++ Source or Header  |  1995-04-15  |  1KB  |  44 lines

  1. /** showicon.c  v1.0  azteccv5.0  (c)1994 Dalibor S.Kezele **/
  2.  
  3. /* shortification to make code readable on 80colon' display */
  4.  
  5. #include <stdio.h>
  6. #include <workbench/workbench.h>
  7. #include <workbench/icon.h>
  8. #include <intuition/intuition.h>
  9.  
  10. struct Library *IconBase;
  11. struct IntuitionBase *IntuitionBase;
  12.  
  13. struct DiskObject *DO;
  14. struct Gadget *GD;
  15. struct NewWindow NW = { 0, 11, 640, 245, 0, 1, CLOSEWINDOW|VANILLAKEY,
  16.     WINDOWDRAG|WINDOWCLOSE|WINDOWDEPTH|ACTIVATE|RMBTRAP|NOCAREREFRESH,
  17.     NULL, NULL, (UBYTE *)"ShowIcon", NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN };
  18. struct Window *WD;
  19. struct IntuiMessage *IM = NULL;
  20.  
  21. void main(int argc, char **argv)
  22. {
  23. if((argc!=2)||((argc==2)&&(*(*(argv+1))=='?'))) {
  24.     puts("\033[33mShowIcon\033[31m v1.0 by Dalibor S.Kezele");
  25.     puts("Usage: ShowIcon <filename> or <?> !");
  26.     exit(1);
  27.     }
  28. if(IconBase = (struct Library *)OpenLibrary(ICONNAME, 0L))
  29.     if(DO = (struct DiskObject *)GetDiskObject(*(argv+1))) {
  30.         if(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0L))
  31.             GD = (struct Gadget *)&DO -> do_Gadget;
  32.             NW.FirstGadget = GD;
  33.             if(WD = (struct Window *) OpenWindow(&NW)) {
  34.                 while((IM -> Class != CLOSEWINDOW)&&( IM -> Class != VANILLAKEY))
  35.                     IM = (struct IntuiMessage *)GetMsg(WD -> UserPort);
  36.                 ReplyMsg(IM);
  37.                 CloseWindow(WD);
  38.                 FreeDiskObject(DO);
  39.                 CloseLibrary(IconBase);
  40.                 CloseLibrary(IntuitionBase);
  41.                 }
  42.             }
  43. }
  44.